package com.woniuxy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.entity.Region;
import com.woniuxy.provider.RegionProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 * 行政区域Mapper接口
 */
public interface RegionMapper extends BaseMapper<Region> {
    //根据父id查询区名称
    @Select("select * from gfr_region where parentId = 5")
    List<Region> getArea();

    @SelectProvider(value = RegionProvider.class,method = "selectAll")
    List<Region> getAll(Region region);


    /**
     * 通过id查找行政区域的名字
     * @param id
     * @return
     */
    @Select("select region from gfr_region where id=#{id}")
    String getRegionById(int id);

    /*@Select("select * from gfr_region where type=#{type}")
    List<Region> getByType(int type);*/
}
